/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication4;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 *
 * @author PeSu
 */
public class JavaApplication4 {
public static String readPage(String url) throws IOException {
		URL u = new URL(url);
		HttpURLConnection con = (HttpURLConnection) u.openConnection();
		InputStream is = con.getInputStream();
		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
		
		char[] buffer = new char[8192];
		int read = 0;
		StringBuilder sb = new StringBuilder();
		
		while ((read = reader.read(buffer)) != -1)
			sb.append(buffer, 0, read);
		return sb.toString();
	}
    public static void main(String[] args) throws IOException {
        System.out.print(readPage("http://doisong.vnexpress.net/"));
    }
}
